package JdbcTest.login;

import java.sql.Connection;
import java.util.Scanner;

/*
用户登录程序
 */
public class login {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(true){
            System.out.println("根据数字完成操作 1.登录 0.退出系统");
            int num = scanner.nextInt();
            switch (num){
                case 1:
                    System.out.println("请输入用户名及密码:");
                    String username = scanner.next();
                    String password = scanner.next();
                    //连接数据库
                    Connection conn = DatabaseConnection.MyConnect();
                    //查询数据库中是否存在该用户的用户名及密码
                    DatabaseConnection.MySelect(conn,username,password);
                    break;
                case 0:
                    return;
            }
        }
    }
}
